package simbot.example.demo.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import simbot.example.demo.entity.User;
import simbot.example.demo.entity.UserInfo;

import java.util.List;
import java.util.Map;


/**
 *
 * @author kali
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {


    @Select("<script>" +
            " SELECT 'username' as qq,mobile as phone  FROM 8eqq " +
            "<where>" +
            "<if test='ew != null'>" +
            " ${ew.sqlSegment} " +
            "</if>" +
            "</where>" +
            "</script>")
    IPage<UserInfo> getUser(@Param("ew") QueryWrapper<Map> qu, Page<Map> page);


    @Select("<script>" +
            " SELECT 'username' as qq,mobile as phone  FROM 8eqq " +
            "<where>" +
            "<if test='ew != null'>" +
            " ${ew.sqlSegment} " +
            "</if>" +
            "</where> limit 1" +
            "</script>")
    List<UserInfo> getUserS(@Param("ew") QueryWrapper<Map> qu);

    //获取短信轰炸的url
    @Select(" SELECT replace(url,'$$',#{phone}) url FROM dxhz ")
    List<String> getDxhzUrl(String phone);
}
